using System;
using System.Collections.Generic;
using ebcpatterns.rx;
using NUnit.Framework;

namespace ebcpatterns.tests.rx
{
    [TestFixture]
    public class test_StandardEventToStream
    {
        [Test]
        public void Several_events()
        {
            var s = new Event_source();

            var sut = new StandardEventToStream();
            var values = new List<StandardEventToStreamArgs>();
            sut.Event += values.Add;

            s.OnSomething += sut.Process;

            s.Fire();
            s.Fire();

            Assert.AreEqual(2, values.Count);
            Assert.AreSame(s, values[0].Sender);
            Assert.IsInstanceOf<EventArgs>(values[0].Args);
        }
    }


    public class Event_source
    {
        public void Fire()
        {
            this.OnSomething(this, new EventArgs());
        }

        public event EventHandler OnSomething;
    }
}